package work.linruchang.mybatisplussamplestest.bean;

import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;
import work.linruchang.mybatisplussamplestest.enums.IsDelEnum;

/**
 * 作用：
 *
 * @author LinRuChang
 * @version 1.0
 * @date 2020/09/22
 * @since 1.8
 **/
@Getter
@Setter
@ToString
@Accessors(chain = true)
public class BaseDB<T extends BaseDB<?>> extends Model<T> {


    private static final long serialVersionUID = 3253505422347170166L;


    /** 主键 - 记录插入自动填充主键处理{@path application.yml} */
    @TableId
    private String id;

    @TableField(fill = FieldFill.INSERT)
    private String createTime;

    @TableField(fill = FieldFill.INSERT_UPDATE)
    private String updateTime;

    /** 记录是否被逻辑删除：0未删除 1逻辑删除 - 逻辑处理值定义{@path application.yml}*/
    @TableField
    @TableLogic
    private Integer isDel;

    @TableField("is_del")
    private IsDelEnum isDelEnum;

    /**
     * 乐观锁(记录的被修改数)
     *
     * 很鸡肋，需要通过代码查出记录然后手动取此对象的version给准备update的对象，或者直接在查出记录上进行update
     */
    @TableField
    @Version
    private Integer version;


}
